﻿<phone:PhoneApplicationPage
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    x:Class="MineSweeping.TopsPage"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:Tops="clr-namespace:MineSweeping.AppCode.Tops"
    xmlns:ad="clr-namespace:Microsoft.Advertising.Mobile.UI;assembly=Microsoft.Advertising.Mobile.UI"
    SupportedOrientations="Landscape" Orientation="Landscape"
    mc:Ignorable="d" d:DesignHeight="480" d:DesignWidth="800"
    shell:SystemTray.IsVisible="False" BorderBrush="{x:Null}" >
    <phone:PhoneApplicationPage.Resources>
        <!--Converters -->
        <!--<Tops:IndexConverter x:Key="IndexConverter" />-->
        <Tops:RankConverter x:Key="RankConverter" />
        <Tops:ScoreConverter x:Key="ScoreConverter" />
        <Tops:DateTimeConverter x:Key="DateTimeConverter" />

        <Style x:Key="RadioDifficultyButton" TargetType="RadioButton">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="RadioButton">
                        <Grid>
                    		<VisualStateManager.VisualStateGroups>
                    			<VisualStateGroup x:Name="CheckStates">
                    				<VisualState x:Name="Checked">
                    					<Storyboard>
                    						<ColorAnimation Duration="0" To="#FF5888FD" Storyboard.TargetProperty="(Shape.Stroke).(SolidColorBrush.Color)" Storyboard.TargetName="rectangle" d:IsOptimized="True"/>
                    						<DoubleAnimation Duration="0" To="3" Storyboard.TargetProperty="(Shape.StrokeThickness)" Storyboard.TargetName="rectangle" d:IsOptimized="True"/>
                    						<ColorAnimation Duration="0" To="#FE4E6BDC" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[3].(GradientStop.Color)" Storyboard.TargetName="rectangle" d:IsOptimized="True"/>
                    						<DoubleAnimation Duration="0" To="0.054" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Offset)" Storyboard.TargetName="rectangle" d:IsOptimized="True"/>
                    						<ColorAnimation Duration="0" To="#FF0E0A3B" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)" Storyboard.TargetName="rectangle" d:IsOptimized="True"/>
                    						<ColorAnimation Duration="0" To="#FF05063D" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[2].(GradientStop.Color)" Storyboard.TargetName="rectangle" d:IsOptimized="True"/>
                    						<DoubleAnimation Duration="0" To="0.25" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[0].(GradientStop.Offset)" Storyboard.TargetName="rectangle" d:IsOptimized="True"/>
                    						<ColorAnimation Duration="0" To="#FF215ED6" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[0].(GradientStop.Color)" Storyboard.TargetName="rectangle" d:IsOptimized="True"/>
                    						<DoubleAnimation Duration="0" To="0.75" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[3].(GradientStop.Offset)" Storyboard.TargetName="rectangle" d:IsOptimized="True"/>
                    					</Storyboard>
                    				</VisualState>
                    				<VisualState x:Name="Unchecked"/>
                    				<VisualState x:Name="Indeterminate"/>
                    			</VisualStateGroup>
                    			<VisualStateGroup x:Name="CommonStates">
                    				<VisualState x:Name="Pressed"/>
                    				<VisualState x:Name="Normal"/>
                    				<VisualState x:Name="MouseOver"/>
                    				<VisualState x:Name="Disabled"/>
                    			</VisualStateGroup>
                    		</VisualStateManager.VisualStateGroups>
                    		<Rectangle x:Name="rectangle" Stroke="Black" RadiusX="2" RadiusY="2" StrokeThickness="2">
                    			<Rectangle.Fill>
                    				<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    					<GradientStop Color="#FF5A545C" Offset="0.186"/>
                    					<GradientStop Color="#FF101014" Offset="0.045"/>
                    					<GradientStop Color="#FF050606" Offset="0.988"/>
                    					<GradientStop Color="#FE312E32" Offset="0.826"/>
                    				</LinearGradientBrush>
                    			</Rectangle.Fill>
                    		</Rectangle>
                    		<ContentPresenter Margin="0" d:LayoutOverrides="Height" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                    	</Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <Style x:Key="BtnBack" TargetType="Button">
        	<Setter Property="Template">
        		<Setter.Value>
        			<ControlTemplate TargetType="Button">
        				<Grid>
        					<Rectangle RadiusY="10" RadiusX="10" Stroke="Black" StrokeThickness="2">
        						<Rectangle.Fill>
        							<LinearGradientBrush EndPoint="0.5,1" MappingMode="RelativeToBoundingBox" StartPoint="0.5,0">
                                        <GradientStop Color="#FE4E6BDC" Offset="0.8"/>
        								<GradientStop Color="#FF07075E" Offset="0.95"/>
        								<GradientStop Color="#FF101012" Offset="0.012"/>
                                        <GradientStop Color="#FE4E6BDC" Offset="0.15"/>
        							</LinearGradientBrush>
        						</Rectangle.Fill>
        					</Rectangle>
        					<ContentPresenter Margin="0" d:LayoutOverrides="Width, Height" VerticalAlignment="Center" HorizontalAlignment="Center"/>
        				</Grid>
        			</ControlTemplate>
        		</Setter.Value>
        	</Setter>
        </Style>
        <Storyboard x:Name="storyShowLocalTops">
        	<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateX)" Storyboard.TargetName="listLocalTops">
        		<EasingDoubleKeyFrame KeyTime="0" Value="800"/>
        		<EasingDoubleKeyFrame KeyTime="0:0:1" Value="0"/>
        	</DoubleAnimationUsingKeyFrames>
        	<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateY)" Storyboard.TargetName="listLocalTops">
        		<EasingDoubleKeyFrame KeyTime="0" Value="0"/>
        		<EasingDoubleKeyFrame KeyTime="0:0:1" Value="0"/>
        	</DoubleAnimationUsingKeyFrames>
        </Storyboard>
    </phone:PhoneApplicationPage.Resources>

    <!--演示 ApplicationBar 用法的示例代码-->
    <!--<phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
            <shell:ApplicationBarIconButton IconUri="/Images/appbar_button1.png" Text="按钮 1"/>
            <shell:ApplicationBarIconButton IconUri="/Images/appbar_button2.png" Text="按钮 2"/>
            <shell:ApplicationBar.MenuItems>
                <shell:ApplicationBarMenuItem Text="菜单项 1"/>
                <shell:ApplicationBarMenuItem Text="菜单项 2"/>
            </shell:ApplicationBar.MenuItems>
        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>-->

    <phone:PhoneApplicationPage.FontFamily>
        <StaticResource ResourceKey="PhoneFontFamilyNormal"/>
    </phone:PhoneApplicationPage.FontFamily>
    <phone:PhoneApplicationPage.FontSize>
        <StaticResource ResourceKey="PhoneFontSizeNormal"/>
    </phone:PhoneApplicationPage.FontSize>
    <phone:PhoneApplicationPage.Foreground>
        <StaticResource ResourceKey="PhoneForegroundBrush"/>
    </phone:PhoneApplicationPage.Foreground>
    <!--LayoutRoot 是包含所有页面内容的根网格-->
    <Grid x:Name="LayoutRoot" Opacity="1" Background="Black">
        <!--<Grid.Background>
            <ImageBrush ImageSource="/Picture/RecordBack.png" />
        </Grid.Background>-->
        <Grid.RowDefinitions>
            <RowDefinition Height="100"/>
            <RowDefinition/>
            <RowDefinition Height="80"/>
        </Grid.RowDefinitions>
        <Grid Grid.Row="0">
            <TextBlock Text="我的排行榜" VerticalAlignment="Center" FontWeight="Bold" Foreground="White" FontSize="56" FontFamily="Microsoft MHei" />
        </Grid>
        <Grid Grid.Row="1">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="200"/>
                <ColumnDefinition />
            </Grid.ColumnDefinitions>
            <Grid Grid.Column="1" x:Name="gridLocalTops" Margin="3,0,0,0">
                <StackPanel Height="50" VerticalAlignment="Top" Orientation="Horizontal" >
                    <StackPanel.Background>
                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                            <GradientStop Color="#FF838389" Offset="0.05"/>
                            <GradientStop Color="#FF040304" Offset="0.996"/>
                            <GradientStop Color="#FF3B343D" Offset="0.8"/>
                            <GradientStop Color="#FF14141A" Offset="0.3"/>
                        </LinearGradientBrush>
                    </StackPanel.Background>
                    <TextBlock Text="排     名" Width="180" Height="30" Margin="20,0,0,0" TextAlignment="Center" Foreground="White" FontSize="26" />
                    <TextBlock Text="成     绩" Width="180" Height="30" TextAlignment="Center" Foreground="White" FontSize="26"/>
                    <TextBlock Text="时     间" Width="180" Height="30" TextAlignment="Center" Foreground="White" FontSize="26"/>
                </StackPanel>
                <ListBox x:Name="listLocalTops" Margin="0,50,0,0" RenderTransformOrigin="0.5,0.5">
                    <ListBox.RenderTransform>
                        <CompositeTransform/>
                    </ListBox.RenderTransform>
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <StackPanel Orientation="Horizontal" Margin="1" Height="40" Background="#FF215ED6" >
                                <TextBlock Text="{Binding Path=Id, Converter={StaticResource RankConverter}}" Width="180" Height="30" Margin="20,0,0,0" TextAlignment="Center" FontSize="24" VerticalAlignment="Center" FontStyle="Italic" FontWeight="Bold" Foreground="White" />
                                <TextBlock Text="{Binding Path=Score, Converter={StaticResource ScoreConverter}}" Width="190" Height="30" TextAlignment="Center" Foreground="White" FontSize="24" VerticalAlignment="Center" FontWeight="Bold" FontFamily="Segoe WP"/>
                                <TextBlock Text="{Binding Path=CreateDate, Converter={StaticResource DateTimeConverter}}" Width="200" Height="30" TextAlignment="Center" Foreground="White" FontSize="24" VerticalAlignment="Center" FontWeight="Bold" FontFamily="Segoe WP"/>
                            </StackPanel>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>
            </Grid>
            <StackPanel Grid.Column="0" Background="#FF312828">
                <RadioButton x:Name="radioLocalEasy" Content="简    单" GroupName="localDifficultGroup" Height="80" Width="180" Style="{StaticResource RadioDifficultyButton}" Checked="OnLocalButtonChecked" Margin="0,10,0,10" FontSize="32" FontWeight="Bold" Foreground="White"/>
                <RadioButton x:Name="radioLocalMedium" Content="中    等" GroupName="localDifficultGroup" Height="80" Width="180" Style="{StaticResource RadioDifficultyButton}" Checked="OnLocalButtonChecked" Margin="0,0,0,10" FontSize="32" FontWeight="Bold" Foreground="White"/>
                <RadioButton x:Name="radioLocalHard" Content="困    难" GroupName="localDifficultGroup" Height="80" Width="180" Style="{StaticResource RadioDifficultyButton}" Checked="OnLocalButtonChecked" Margin="0,0,0,10" FontSize="32" FontWeight="Bold" Foreground="White"/>
            </StackPanel>
        </Grid>
        <Grid Grid.Row="2">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition/>
                    <ColumnDefinition Width="120"/>
                    <ColumnDefinition Width="480"/>
                </Grid.ColumnDefinitions>
                <Button x:Name="btnBack" Content="回到游戏" Grid.Column="0" Foreground="White" Style="{StaticResource BtnBack}" Margin="1" BorderThickness="3,0,0,0" FontSize="25" Click="btnBack_Click" />
                <Button x:Name="btnVote" Content="投票" Grid.Column="1" Foreground="White" Style="{StaticResource BtnBack}" Margin="1" BorderThickness="0,0,3,0" FontSize="25" Click="btnVote_Click" />
                <ad:AdControl AdUnitId="93488" 
                              ApplicationId="bbc1f0f3-1ade-425d-ae0d-5bf8f1fae759" 
                              Grid.Column="2" Height="80" Width="480"
                              />
               
            </Grid>
        </Grid>
    </Grid>

</phone:PhoneApplicationPage>
